"""init academic models

Revision ID: 28c9cd2eb998
Revises: 
Create Date: 2025-11-03 11:28:41.047812

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '28c9cd2eb998'
down_revision: Union[str, Sequence[str], None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('author',
    sa.Column('author_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('author_name', sa.String(length=100), nullable=False),
    sa.Column('email', sa.String(length=255), nullable=True),
    sa.Column('affiliation', sa.String(length=255), nullable=True),
    sa.Column('affiliation_country', sa.String(length=100), nullable=True),
    sa.Column('affiliation_city', sa.String(length=100), nullable=True),
    sa.Column('created_at', sa.TIMESTAMP(), nullable=True),
    sa.Column('updated_at', sa.TIMESTAMP(), nullable=True),
    sa.PrimaryKeyConstraint('author_id')
    )
    op.create_table('conference',
    sa.Column('conference_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('full_name', sa.String(length=255), nullable=False),
    sa.Column('short_name', sa.String(length=50), nullable=True),
    sa.Column('year', sa.Integer(), nullable=False),
    sa.Column('location', sa.String(length=100), nullable=True),
    sa.Column('start_date', sa.Date(), nullable=True),
    sa.Column('end_date', sa.Date(), nullable=True),
    sa.Column('website', sa.String(length=255), nullable=True),
    sa.Column('topics', sa.JSON(), nullable=True),
    sa.Column('created_at', sa.TIMESTAMP(), nullable=True),
    sa.Column('updated_at', sa.TIMESTAMP(), nullable=True),
    sa.PrimaryKeyConstraint('conference_id')
    )
    op.create_table('paper',
    sa.Column('paper_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('title', sa.String(length=255), nullable=False),
    sa.Column('conference_id', sa.Integer(), nullable=True),
    sa.Column('publication_year', sa.Integer(), nullable=True),
    sa.Column('abstract', sa.Text(), nullable=True),
    sa.Column('keywords', sa.String(length=255), nullable=True),
    sa.Column('author_ids', sa.String(length=500), nullable=True),
    sa.Column('reference_ids', sa.String(length=500), nullable=True),
    sa.Column('topic', sa.String(length=100), nullable=True),
    sa.Column('created_at', sa.TIMESTAMP(), nullable=True),
    sa.Column('updated_at', sa.TIMESTAMP(), nullable=True),
    sa.PrimaryKeyConstraint('paper_id')
    )
    op.create_table('paper_author_relation',
    sa.Column('relation_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('paper_id', sa.Integer(), nullable=True),
    sa.Column('author_id', sa.Integer(), nullable=True),
    sa.Column('author_order', sa.Integer(), nullable=False),
    sa.Column('is_corresponding', sa.Boolean(), nullable=False),
    sa.Column('created_at', sa.TIMESTAMP(), nullable=True),
    sa.PrimaryKeyConstraint('relation_id')
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('paper_author_relation')
    op.drop_table('paper')
    op.drop_table('conference')
    op.drop_table('author')
    # ### end Alembic commands ###
